﻿using System;
using System.Web;
using System.Text;
using System.Data.OleDb;

public class showad : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {        
        ShowList(context);
    }

    private void ShowList(HttpContext context)
    {
        context.Response.Charset = "text/xml";
        string softname = context.Request.QueryString["soft"];
        StringBuilder str = new StringBuilder();
        string sql=string.Format("select * from S_SoftAd where softname='{0}' order by px desc",softname);
        OleDbDataReader dr = Dukey.DBUtility.DbHelper.ExecuteReader(sql);
        str.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
        str.Append("<ad>");
        while (dr.Read())
        {
            str.Append(string.Format("<link url=\"{0}\">{1}</link>", dr["url"].ToString(), dr["title"].ToString()));
        }
        dr.Dispose();
        str.Append("</ad>");
        context.Response.Write(str.ToString());
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}